package com.yz.aiks.multimodules.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import static com.yz.aiks.multimodules.config.JedisConfig.JEDISCONFIG_PREFIX;

/**
 * @author <a href="mailto:aiks_yuan@163.com">yuanz</a>
 * @date 2022-02-24 10:31
 * @since 1.0.0
 **/
@Data
@ConfigurationProperties(prefix = JEDISCONFIG_PREFIX)
public class JedisConfig {
    public static final String JEDISCONFIG_PREFIX = "aiks.redis";
    
    private String hostname;
    private int port;
    private Pool pool = new Pool();
    private String password;
    private int timeout;
    private boolean blockWhenExhausted;
    
    @Data
    public static class Pool {
        
        private int maxWaitMillis = 8;
        
        private int minIdle = 8;
        
        private int maxIdle = 8;
        
        private int maxTotal = 8;
        
        private boolean testWhileIdle;
        
        private boolean testOnBorrow;
        
        private Long timeBetweenEvictionRunsMillis = 1000L;
    }
}
